package java67_14.score;

public class Jiaowuchu {
	// 另外一种计算平均成绩的方法
	public float calcAvg2(String name, float java, float html, float db) {
		if (name.equals("刘二")) {
			java += 10;
			html += 10;
			db += 10;
		}
		System.out.println("学生信息如下:姓名:" + name);
		System.out.println("java " + java + "分,html:" + html + "分,db " + db + "分");
		float avg = (java + html + db) / 3;
		return avg;
	}

	public float calcAvg(Student s) {
		System.out.println("开始计算" + s.name + "的平均分");
		if (s.name.equals("王二麻")) {
			s.java += 10;
			s.db += 10;
			s.html += 10;
		}
		System.out.println("计算开始....");
		s.selfIntroduction();
		float sum = s.java + s.db + s.html;
		return sum / 3;
	}

	// 统计多名学生 java的平均成绩
	public float calcAvgJava(Student[] sr) {
		float total = 0;
		for (Student s : sr) {
			total += s.java;
		}
		float avg = total / sr.length;
		return avg;
	}
}
